{% extends "personal_center/base.html" %}
<!--固定资产付款申请详情页-->
{% block page_link %}
    <link href="../../static/orderscreate/css/fileinput.min.css" rel="stylesheet">
    <link href="../../static/orderscreate/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../../static/orderscreate/css/font-awesome.4.6.0.css">
    <link href="../../static/orderscreate/form_builder/animate.min.css" rel="stylesheet">
    <link href="../../static/orderscreate/form_builder/summernote.css" rel="stylesheet">

    <link rel="stylesheet" type="text/css" href="../../static/jqueryjsPlumb/css/jquery-ui.min.css">
    <link rel="stylesheet" type="text/css" href="../../static/jqueryjsPlumb/css/style.css">

    <link href="../../static/orderscreate/form_builder/style.min862f.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../../static/orderscreate/css/index.css">
    <script src="../../static/system_setup/creat_from/js/jquery-1.10.2.js"></script>
{#    <script src="../../static/orderscreate/javascript/bootstrap.min.js"></script>#}
    <script src="../../static/orderscreate/javascript/fileinput.min.js"></script>
    <script src="../../static/orderscreate/javascript/bootstrap-datetimepicker.min.js"></script>
    <script src="../../static/orderscreate/javascript/distpicker.data.min.js"></script>
    <script src="../../static/orderscreate/javascript/distpicker.min.js"></script>
    <script src="../../static/orderscreate/javascript/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../../static/orderscreate/javascript/zh.js"></script>
    <script src="../../static/orderscreate/javascript/jquery-ui.min.js"></script>
    <script src="../../static/orderscreate/form_builder/beautifyhtml.js"></script>
    <script src="../../static/orderscreate/javascript/index.js"></script>
    <link rel="stylesheet" href="../../static/technological/css/style.css">
    <link rel="stylesheet" type="text/css" href="../../static/finance/css/custom.css">
    <script type="text/javascript" src="../../static/public_file/js/ModalBox1.js"></script>
{% endblock %}

{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;color: #01AAED;
        }
        .tab_top {
            width: 100px;height: 40px;line-height: 40px;text-align: center;display: inline-block;cursor: pointer;
        }
        .a_tag_cla{
            display: block;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;height: 30px;line-height: 30px;padding-left: 1%;
        }
        .button_for_control {
            width: 90px;height: 30px;border: 1px solid #99D3F5;background: #D0EEFF;border-radius: 4px;letter-spacing: 0;line-height: 30px;color: #089bab;margin-top: 5px;
        }
        #page_one button:hover {
            color: red;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div class="headline">
        <div id="DW_tag" class="tab_top top_tag" onclick="change_mind('DW')">
            申请详情
        </div>
        <div id="LH_tag" class="tab_top" onclick="change_mind('LH')" {% if file_path == '' %}style="display: none"{% endif %}>
            附件
        </div>
        <div id="lct_tag" class="tab_top" onclick="change_mind('lct')">
            流程图
        </div>

        <div id="" style="width: 100px;float: right;text-align: center;margin-right: 1%;height: 40px;">
            <button id="" onmousemove="page_zhanshi()" onmouseout="page_yincang()" style="width: 100px;height: 30px;line-height: 27px;border: #1E90FF solid 1px;background: #1E90FF;color: white;margin-top: 5px;border-radius: 3px;">
                操作
            </button>
        </div>

        <div id="page_one" onmousemove="page_zhanshi()" onmouseout="page_yincang()"
             style="z-index: 1000; position: absolute; width: 100px; height: auto;right: 0.9%; top: 80px;background: #FFFFFF; box-shadow: rgb(204 204 204) 2px 2px 10px;padding: 5px;display: none;">
            <button onclick="print_topics()" class="button_for_control">
                打印
            </button>

            {% if data.is_audit == 'true' %}
                <button id="approve" onclick="online_tag()" class="button_for_control">
                    审批
                </button>
            {% endif %}

            {% if data.is_edit == 'true' %}
                <button id="submit_data" onclick="ExportCar()" class="button_for_control">
                    修改
                </button>
            {% endif %}

            {% if data.is_stop == 'true' %}
                <button onclick="operate_button('is_stop')" class="button_for_control">
                    终止
                </button>
            {% endif %}
        </div>

        <div style="width: 110px;float: right;text-align: center;margin-right: 6px;height: 40px;">
            <button style="line-height: 27px;border-radius: 3px;border: #1E90FF solid 0.5px;width: 100px;height: 30px;margin-top: 5px;background: #1E90FF;color: white;" onclick="javascript:history.back(-1)">
                返回
            </button>
        </div>
    </div>
    <hr>
    <div id="new_models" style="width: 80%;height: 80%;display: none;position: absolute">
        <div style="width: 700px;height: 500px;background: #F5F5F5;z-index: 10100;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
            <div id="box" style="width: 100%;height: 50px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                <h5 id="modal-title" class="modal-title"
                    style="line-height: 50px;margin-left: 1%;display: inline-block;">审批</h5>
                <span onclick="close_models()"
                      style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i
                        class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="height: 400px;width: 100%;padding-top: 2%;padding-left: 2%;">
                <div style="width: 100%">
                    <div style="display: inline-block; width: 30%;">
                        <label style="vertical-align: top;">审批</label>
                        <input type="radio" name="approve" value="audit" checked>同意
                        <input style="margin-left: 3%;" type="radio" name="approve" value="draft">不同意
                    </div>
                </div>
                <div style="margin-top: 2%;width: 100%;">
                    <label style="vertical-align: top;">意见</label>
                    <textarea name="" id="opinion_detail" cols="30" rows="10" style="width: 90%;"></textarea>
                </div>
            </div>
            <hr>
            <div style="width: 100%;height: 50px;text-align: right;padding-right: 2%; position: absolute; bottom: 0; right: 18px;">
                <button onclick="summit_data()" style="width: 100px;height: 30px;border: #dfdfdf solid 1px;margin-top: 10px;border-radius: 3px;background: #1E90FF;color: white;">提交</button>
            </div>
        </div>
    </div>

    <div id="DW" style="width: 100%;height: 95%;background: white;overflow: auto;"  >
        <div style="width: 100%;height: 100%;overflow: auto;">
            <div id="menu_from1" style="width: 100%;height: 100%;color: #2C3E50;display: inline-block;vertical-align: top;background: white;">
                <div id="menu_from">{% autoescape off %}{{ data.business_html }}{% endautoescape %}</div>

                <table style="width: 90%;margin-left: 5%;">
                    <tr style="width: 100%;">
                        <td colspan="4" style="width: 100%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #F5F5F5;border: #cccccc solid 0.5px;border-top: none;">
                            审批详情
                        </td>
                    </tr>
                    {% for k, v in data.audit_list.items %}
                        <tr style="width: 100%;">
                            <td style="width: 15%;height: 150px;border: #cccccc solid 1px;text-align: right;padding-right: 1%;border-top: none;">
                                <p style="width: 130px;float: right;text-align-last: justify;">{{ k }}</p>
                            </td>
                            <td colspan="3" style="width: 85%;height: 150px;border: #cccccc solid 1px;border-left: none;border-top: none;padding-left: 15px;">
{#                                {% for keys in v %}#}
                                {% for item in v %}
                                    {% if item.state != 'unaudit' %}
                                        <div style="width: 100%;line-height: 20px;position: relative;">
                                            <span>{{ item.state_display }}</span>
                                            <span style="margin-left: 3%">{{ item.audit_note }}</span>
                                        </div>
                                        <div>
                                            <img src="{{ item.signature_picture }}" alt="" style="width: 150px; height: 60px;">
                                        </div>
                                        <div style="text-align: right;color: #0b0b0b;">{{ item.audit_time }}</div>
                                    {% endif %}
                                {% endfor %}
{#                                {% endfor %}#}
                            </td>
                        </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
    </div>

    <div id="LH" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="display: inline-block;width: 20%;vertical-align: top;height: 99%">
            <div style="width: 100%;height: 40px;background: #c8cbcf;padding-left: 2%;line-height: 40px;color: #0c6fd9;">
                附件
            </div>
            <div id="yt_zhengwen" style="width: 100%;">
                {% for item in data.file_list %}
                    <div><a href="#" class="a_tag_cla" onclick="chage_yulan(this, '{{ item.file_path }}')">{{ item.file_name }}</a></div>
                {% endfor %}
            </div>
        </div>
        <div style="display: inline-block;width: 78%;vertical-align: top;height: 99%;text-align: center;" id="fujian">
            {% if 'jpg' in file_path or 'JPG' in file_path or 'JPEG' in file_path or 'jpeg' in file_path or 'PNG' in file_path or 'png' in file_path %}
                <img src="{{ file_path }}" alt="" style="width: 800px;height: 100%;">
            {% else %}
                <embed id="embed_file" src="{{ file_path }}" type="application/pdf" style="width: 100%;height: 100%;">
            {% endif %}
        </div>
    </div>

    <div id="lct" style="width: 100%;height: 94%;background: white;display: none;">
        <div style="width: 100%;height: 40%;text-align: center;margin: 20% auto;">
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    ({{ obj.apply_user.real_name }})<br>
                    发起人
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    start
                </div>
            </div>

            {% for ite in flow_dict %}
                <div style="display: inline-block;{% if ite.apply == 'true' %} border: #0d8ddb solid 1px; {% else %} border: #cfcfcf solid 1px; {% endif %}width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
                <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                    <div style="text-align: center;{% if ite.apply == 'true' %} color: #0d8ddb; {% endif %}">
                        ({{ ite.apply_people }})<br>
                        {{ ite.node }}
                    </div>
                    <div style="width: 25px;height: 25px;border-radius: 50%;{% if ite.apply == 'true' %} background: #0d8ddb; {% else %} background: #cfcfcf; {% endif %}color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                        {{ ite.sear }}
                    </div>
                </div>
            {% endfor %}

            <div style="display: inline-block;border: #0d8ddb solid 1px;width: 150px;vertical-align: bottom;margin-bottom: 12px;"></div>
            <div style="display: inline-block;vertical-align: top;cursor: pointer;text-align: center;">
                <div style="text-align: center;color: #0d8ddb;">
                    <span style="visibility: hidden;">({{ obj.apply_user.real_name }})</span><br>
                    结束
                </div>
                <div style="width: 50px;height: 25px;border-radius: 3px;background: #0d8ddb;color: white;text-align: center;display: inline-block;font-size: 12px;line-height: 25px;">
                    ending
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script src="../../static/jqueryjsPlumb/js/jquery-1.10.2.js"></script>
    <script type="text/javascript" src="../../static/jqueryjsPlumb/js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="../../static/jqueryjsPlumb/js/jquery.jsPlumb.min.js"></script>
    <script type="text/javascript" src="../../static/jqueryjsPlumb/js/index.js"></script>
    <script src="../../static/administrative/layDate-v5.0.9/laydate/laydate.js"></script> <!-- 改成你的路径 -->
    <script type="text/javascript" src="../../static/finance/js/custom.js"></script>
    <script language="javascript" src="../../static/personal_center/js/jquery.jqprint-0.3.js"></script>

    <script>
        window.onload = function () {
            document.getElementsByClassName("right_body")[0].style.width = "85.5%";
            document.getElementById("loading").style.display = "none";
            document.getElementById("personage").className = "add_class";
            document.getElementById("sponsor").className = "add-nav-active";
            var is_edit = '{{ is_edit }}';             // 判断是否可以修改参数
            if (is_edit === "false") {
                var label_value_list = document.getElementsByClassName('label_value');
                for (var val=0; val<label_value_list.length; val++) {
                    if (label_value_list[val] !== '')
                    label_value_list[val].contentEditable = false;
                }
            }else {
                var label_count = document.getElementsByClassName('label_value label_time').length+1;
                for (var ti=1; ti<label_count; ti++){
                    lay('#version').html('-v' + laydate.v);

                    //执行一个laydate实例
                    laydate.render({
                        elem: '#time_'+String(ti), //指定元素
                        type: 'date',
                        format: 'yyyy-MM-dd'
                    });
                }
            }
            if (document.getElementById('party_main')) {
                document.getElementById('party_main').style.display = 'none';
            }

            var label_title_list = document.getElementsByClassName('label_title');
            for (var tit=0; tit<label_title_list.length; tit++) {
                label_title_list[tit].contentEditable = false;
            }

            var label_title1_list = document.getElementsByClassName('label_title1');
            for (var tit1=0; tit1<label_title1_list.length; tit1++) {
                label_title1_list[tit1].contentEditable = false;
            }

            var label_value1_list = document.getElementsByClassName('label_value1');
            for (var tit3=0; tit3<label_value1_list.length; tit3++) {
                label_value1_list[tit3].contentEditable = false;
            }

            document.getElementById("create_table").style.removeProperty('height')

            var checkboxeslist = document.querySelectorAll('input[type="checkbox"]');
            for (var ac=0; ac<checkboxeslist.length; ac++) {
                checkboxeslist[ac].disabled = true
            }

            var checkbox_list = document.getElementsByName("choose_checkbox");
            var check_val_list = {{ check_val | safe }};
            for (var eck=0; eck<check_val_list.length; eck++) {
                for (var check_a=0; check_a<check_val_list[eck].length; check_a++) {
                    console.log(check_val_list[eck][check_a])
                    var childElements = checkbox_list[eck].querySelectorAll('input[type="checkbox"]');
                    for (var ab=0; ab<childElements.length; ab++) {
                        if (check_val_list[eck][check_a] === childElements[ab].value) {
                            childElements[ab].checked = true
                        }
                    }
                }
            }
        };

        var uuid = "{{ obj.fj_number | safe }}"

        function change_mind(ele_id) {
            if (ele_id === "DW") {
                document.getElementById("DW").style.display = "inline-block";
                document.getElementById("DW_tag").className = "tab_top top_tag";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
            } else if (ele_id === "LH"){
                document.getElementById("LH").style.display = "inline-block";
                document.getElementById("LH_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("lct_tag").className = "tab_top";
                document.getElementById("lct").style.display = "none";
                {#var main_file = {{ file_list|safe }};#}
                {#chage_yulan(main_file[0]['file_path'])#}
            }else {
                document.getElementById("lct").style.display = "inline-block";
                document.getElementById("lct_tag").className = "tab_top top_tag";
                document.getElementById("DW_tag").className = "tab_top";
                document.getElementById("DW").style.display = "none";
                document.getElementById("LH_tag").className = "tab_top";
                document.getElementById("LH").style.display = "none";
            }
        }

        function chage_yulan(this_, file_path) {
            var fujian = document.getElementById("fujian");
            var file_index = file_path.lastIndexOf(".")
            var ext = file_path.substring(file_index+1)
            var arr=['jpg', 'JPG', "JPEG", "jpeg", "PNG", "png"];
            var ext_index=arr.indexOf(ext);
            if (ext_index === -1){
                fujian.innerHTML = '<embed id="embed_file" src="'+file_path+'" type="" style="width: 100%;height: 100%;">'
            }else {
                fujian.innerHTML = '<img src="' + file_path + '" alt="application/pdf" style="width: 800px;height: 100%;">'
            }

            var a_tag_list = document.getElementsByClassName("a_tag_cla");
            for (var i = 0;i<a_tag_list.length; i++){
                a_tag_list[i].style.background='';
            }
            this_.style.background='#cfcfcf';
        }

        // 上传附件
        function upload_accessory(file_type, tbody_id, accessory_type) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];
            form.append(file_type, files);
            form.append('number', uuid)
            form.append('source', 'gdzcfk')     // 固定资产付款
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/topics_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        creat_table(JsonDate, tbody_id)
                    }
                }
            };
        }

        // 创建附件列表
        function creat_table(JsonData, tbody_id) {
            var t_table = document.getElementById(tbody_id);
            var local_host = window.location.host;
            if (Array.isArray(JsonData["pdf_path"])) {
                for (var i = 0; i < JsonData["pdf_path"].length; i++) {
                    var tr = document.createElement("tr");
                    var td1 = document.createElement("td");var td2 = document.createElement("td");var td3 = document.createElement("td");var td4 = document.createElement("td");var td5 = document.createElement("td");var td6 = document.createElement("td");
                    td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                    td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                    td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                    td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                    td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                    td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"][i]["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["pdf_path"][i]["id"] + "\")'>删除</a>";td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                    tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);t_table.appendChild(tr);
                }
                if (JsonData["pdf_path"].length > 1) {
                    document.getElementById("del_adjunct").style.display = 'block';
                }
            } else {
                tr = document.createElement("tr");td1 = document.createElement("td");td2 = document.createElement("td");td3 = document.createElement("td");td4 = document.createElement("td");td5 = document.createElement("td");td6 = document.createElement("td");
                td1.innerHTML = t_table.children.length + 1;td1.style.textAlign = "center";td1.style.border = "#cccccc solid 1px";td1.style.borderTop = "none";
                td2.innerHTML = JsonData["file_name"];td2.style.paddingLeft = "1%";td2.style.border = "#cccccc solid 1px";td2.style.borderLeft = "none";td2.style.borderTop = "none";
                td3.innerHTML = JsonData["file_size"];td3.style.textAlign = "center";td3.style.border = "#cccccc solid 1px";td3.style.borderLeft = "none";td3.style.borderTop = "none";
                td4.innerHTML = JsonData["upload_time"];td4.style.textAlign = "center";td4.style.border = "#cccccc solid 1px";td4.style.borderLeft = "none";td4.style.borderTop = "none";
                td5.innerHTML = JsonData["uploader"];td5.style.textAlign = "center";td5.style.border = "#cccccc solid 1px";td5.style.borderLeft = "none";td5.style.borderTop = "none";
                td6.innerHTML = "<a target='_blank' href='" + JsonData["pdf_path"] + "'>查看</a> | <a style='color: red;' href='#' onclick='RemoveTr(this, \"" + tbody_id + "\", \"" + JsonData["id"] + "\")'>删除</a>";td6.style.textAlign = "center";td6.style.border = "#cccccc solid 1px";td6.style.borderLeft = "none";td6.style.borderTop = "none";
                tr.appendChild(td1);tr.appendChild(td2);tr.appendChild(td3);tr.appendChild(td4);tr.appendChild(td5);tr.appendChild(td6);t_table.appendChild(tr);
            }
        }

        function RemoveTr(_this, tbody_id, wj_id) {
            var table = document.getElementById(tbody_id);
            var trNode = $(_this).parent().parent();
            trNode.remove();
            for (var i = 0; i < table.children.length; i++) {
                table.children[i].children[0].innerHTML = i + 1;
            }
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/administrative/delete_attachments_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("id=" + String(wj_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert("删除成功！")
                    }
                }
            };
        }

        function page_zhanshi() {
            document.getElementById('page_one').style.display = 'inline-block';
        }

        function page_yincang() {
            document.getElementById('page_one').style.display = 'none';
        }

        function online_tag() {
            document.getElementById("new_models").style.display = "table-row";
        }

        function close_models() {
            document.getElementById("new_models").style.display = "none";
        }

        function operate_button(ele_id) {
            var id = {{ data.id }}
            if (ele_id === 'is_stop') {
                var state = 'stop';     // 终止
                var word = '终止'
            } else if (ele_id === 'is_cancel') {
                state = 'cancel';       // 作废
                word = '作废'
            } else {
                state = 'recall'
                word = '撤回'
            }
            var r = confirm('是否' + word + '流程？')
            if (r === true) {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/personal-center/fixed_assets_revoke_view", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send("state=" + state + "&id=" + id)
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            alert(JsonDate['message'])
                            window.location.href = "/personal-center/fixed_assets_apply_list_view"
                        }
                    }
                };
            }
        }

        function summit_data() {
            var present_id = window.location.href.split("id=")[1].replace("#", '');
            approve = $("input[type=radio][name=approve]:checked").val();
            audit_note = document.getElementById("opinion_detail").value;
            if (approve === "draft") {
                if (!audit_note) {
                    alert("不同意请填写理由！");
                    return false
                }
            }

            var note_str = "id=" + present_id + "&state=" + String(approve) + "&audit_note=" + String(audit_note)
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/low_code_bill_detail_view");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send(note_str);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200) {
                            alert("审批成功");
                            window.location.href = '/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd='
                        } else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function ExportCar() {
            var form = new FormData();
            var form_code = document.getElementById('menu_from').innerHTML;
            var encode = encodeURI(form_code);            // 对字符串进行编码
            var base64_str = btoa(encode);                  // 对编码的字符串转化base64
            var id = String({{ data.cus_id }})
            form.append("data_html", base64_str);
            form.append('customer_form_id', id)
            form.append('fj_number', uuid)       // 离职申请
            form.append('id', {{ data.id }})       // 离职申请
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/low_code_bill_view", true);
            {#xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');#}
            xhr.send(form)
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        alert("提交成功！")
                        window.parent.location.reload()
                    }
                }
             }
        }

        function print_topics() {
            $('#menu_from1').jqprint({
                debug: false,
                importCSS: true,
                printContainer: true,
                operaSupport: false
            });
        }
    </script>
{% endblock %}